import Cookies from 'js-cookie';

/**
 *设置cookie
 * @param {Object} info
 */
export function setUserCookie(info) {
    for (const prop in info) {
        Cookies.set(prop, info[prop]);
    }
    return true;
}

/**
 *获取用户cookie
 *
 * @return {*}
 */
export function getUserCookie() {
    return {
        appkey: Cookies.get('appkey'),
        email: Cookies.get('email'),
        role: Cookies.get('role'),
        username: Cookies.get('username'),
    };
}

/**
 *
 *删除用户cookie
 */
export function deleteUserCookie() {
    Cookies.remove('appkey');
    Cookies.remove('email');
    Cookies.remove('role');
    Cookies.remove('username');
    return true;
}
